package leetcode.秋招.广联达;

import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/9/22 20:35
 * @description：
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int a1 = in.nextInt();
        int b1 = in.nextInt();
        int a2 = in.nextInt();
        int b2 = in.nextInt();
        int maxX = 0, maxY = 0;
        long max = 0;
        for(int i = 0; i <= N; i++) {
            int x = i;
            int y = N - x;
            int a = a1 * x + a2 * y;
            int b = b1 * x + b2 * y;
            long sum = 2 * a * b;
            if (sum > max) {
                max = sum;
                maxX = x;
                maxY = y;
            }
        }
        System.out.println(maxX + " " + maxY);
    }
}
